package my.stock.configure;

import okhttp3.ConnectionPool;
import okhttp3.OkHttpClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Configuration
public class OkHttpConfig {

    @Bean
    public OkHttpClient okHttpClient() {
        // 设置连接池
        ConnectionPool connectionPool = new ConnectionPool(10, 5L, TimeUnit.MINUTES);
        OkHttpClient.Builder builder = new OkHttpClient.Builder()
                .connectionPool(connectionPool);

        // 其他配置
        return builder.build();
    }
}
